package eval.guice;

import com.google.inject.AbstractModule;
import com.google.inject.Provides;

import eval.deploy.DemandManager;
import eval.deploy.DeployGenerator;
import eval.deploy.DeployManager;
import eval.deploy.IDemandManager;
//import eval.deploy.IDemandManager;
import eval.deploy.IDeployGenerator;
import eval.deploy.IDeployManager;
import eval.engine.IPlacementEngine;
import eval.engine.IplacementEngineFactory;
import eval.engine.FireFighting.FireFightingEngine;
//import eval.engine.OptimizationGoalEnum;
import eval.engine.PlacementEngineFactory;
//import eval.engine.cplex.CplexPlacementEngine;
///import eval.engine.cplex.DataModelGenerator;
//import eval.engine.cplex.IDataModelGenerator;
//import eval.engine.heuristic.BestHostForDeployScore;
import eval.engine.openStack.OpenStackEngine;
//import eval.engine.heuristic.IHeuristicScoring;
import eval.host.HostManager;
import eval.host.IHostManager;
import eval.host.compare.AgeHostSortList;
import eval.host.compare.EmptyHostSortList;
import eval.host.compare.ISortHostList;
import eval.host.compare.MaxHostSortLIst;
import eval.hostEvaluate.IHostEvaluate;
import eval.hostEvaluate.SimpleEvaluation;
import eval.results.IResultManager;
import eval.results.ResultManager;
import eval.utilities.configuration.ExperimentConfiguration;
import eval.vm.IVMManager;
import eval.vm.IVMFactory;
import eval.vm.VMManager;
import eval.vm.VMFactory;

public class InjectorModule extends AbstractModule {

	private static ExperimentConfiguration conf = ExperimentConfiguration
			.getSingleton();

	@Override
	protected void configure() {
		
		bind(IDemandManager.class).to(DemandManager.class);
		bind(IHostManager.class).to(HostManager.class);
		bind(IVMManager.class).to(VMManager.class);
		bind(IDeployManager.class).to(DeployManager.class);
		bind(IDeployGenerator.class).to(DeployGenerator.class);
		bind(IplacementEngineFactory.class).to(PlacementEngineFactory.class);
		bind(IVMFactory.class).to(VMFactory.class);
		bind(IResultManager.class).to(ResultManager.class);
		
		if (conf.optimizationGoal.equals("OPEN_STACK"))
			bind(IPlacementEngine.class).to(OpenStackEngine.class);
		else if (conf.optimizationGoal.equals("FIRE_FIGHTING"))
			bind(IPlacementEngine.class).to(FireFightingEngine.class);
//		else if (conf.optimizationGoal.equals("CPLEX"))
//			bind(IPlacementEngine.class).to(CplexPlacementEngine.class);
		
		if(conf.openStackCompareGoal.equals("EMPTY_HOST_SORT"))
			bind(ISortHostList.class).to(EmptyHostSortList.class);
		else if (conf.openStackCompareGoal.equals("MAX_HOST_SORT"))
			bind(ISortHostList.class).to(MaxHostSortLIst.class);
		else if (conf.openStackCompareGoal.equals("AGE_HOST_SORT"))
			bind(ISortHostList.class).to(AgeHostSortList.class);
		
		if(conf.hostEvaluate.equals("SIMPLE_EVALUATION"))
			bind(IHostEvaluate.class).to(SimpleEvaluation.class);
		
//		 bind(IPlacementDataModel.class).to(PlacementDataModel.class);
//		bind(IHeuristicScoring.class).to(BestHostForDeployScore.class);
//		bind(IDataModelGenerator.class).to(DataModelGenerator.class);
	}

	
	
//	@Provides
//	CplexPlacementEngine provideCplexPlacementEngine() {
//		return new CplexPlacementEngine(
//				OptimizationGoalEnum.valueOf(conf.optimizationGoal),
//				getProvider(IDataModelGenerator.class).get());
//	}
}
